package com.javabasic.jvm;

import java.util.ArrayList;

/**
 * @Author xiongmin
 * @Description TODO
 * @Date 2019/10/23 12:15
 * @Version 1.0
 **/
// -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xms1G -Xmx2G
public class JVMParmTest {

    public static void main(String[] args) {

        long start1 = System.currentTimeMillis();
        ArrayList<Integer> arrayList = new ArrayList<>();
        for (int i = 0; i < 10000000; i++) {
            arrayList.add(i);
        }
        System.out.println(System.currentTimeMillis()-start1);

        long start2 = System.currentTimeMillis();
        ArrayList<Integer> arrayList2 = new ArrayList<>();
        for (int i = 10000000; i < 20000000; i++) {
            arrayList2.add(i);
        }
        System.out.println(System.currentTimeMillis()-start2);


        System.out.println("默认最大堆内存---Max_memory="+Runtime.getRuntime().maxMemory()/(double)1024/1024+"M");
        System.out.println("初始化堆内存---Total_memory="+Runtime.getRuntime().totalMemory()/(double)1024/1024+"M");

    }
}
